package work.jame.blog.pojo;

import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonIgnore;
import io.swagger.annotations.ApiModelProperty;
import org.hibernate.validator.constraints.Length;
import work.jame.blog.framework.VerificationGroup;

import javax.validation.constraints.NotNull;
import javax.validation.constraints.Null;
import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * <p>
 *
 * </p>
 *
 * @author Jame
 * @since 2023-05-18
 */
@TableName("user_collect_group")
public class UserCollectGroup implements Serializable {

    private static final long serialVersionUID = 1L;

    @TableId(value = "id", type = IdType.AUTO)
    @Null(message = "非法传入参数", groups = VerificationGroup.Save.class)
    private Long id;

    /**
     * 用户id
     */
    @TableField("user_id")
    @Null(message = "非法传入参数", groups = {VerificationGroup.Save.class, VerificationGroup.Update.class})
    private Long userId;

    /**
     * 分组名称
     */
    @NotNull(message = "组名不能为空", groups = {VerificationGroup.Save.class, VerificationGroup.Update.class})
    @Length(min = 1, max = 20, message = "收藏组名称长度不符合范围", groups = {VerificationGroup.Save.class, VerificationGroup.Update.class})
    @TableField("group_name")
    private String groupName;

    /**
     * 序号
     */
    @TableField("serial_number")
    private Integer serialNumber;

    /**
     * 组是否为公开的
     */
    @TableField("group_is_overt")
    private Boolean groupIsOvert;

    @TableField("deleted")
    @TableLogic
    @Null(message = "非法传入参数", groups = {VerificationGroup.Save.class, VerificationGroup.Update.class})
    @JsonIgnore
    private Boolean deleted;

    @TableField(value = "insert_time", fill = FieldFill.INSERT)
    @ApiModelProperty(hidden = true)
    @Null(message = "非法传入参数", groups = {VerificationGroup.Save.class, VerificationGroup.Update.class})
    private LocalDateTime insertTime;

    @TableField(value = "update_time", fill = FieldFill.INSERT_UPDATE)
    @ApiModelProperty(hidden = true)
    @Null(message = "非法传入参数", groups = {VerificationGroup.Save.class, VerificationGroup.Update.class})
    private LocalDateTime updateTime;
    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public Long getUserId() {
        return userId;
    }

    public void setUserId(Long userId) {
        this.userId = userId;
    }

    public String getGroupName() {
        return groupName;
    }

    public void setGroupName(String groupName) {
        this.groupName = groupName;
    }

    public Integer getSerialNumber() {
        return serialNumber;
    }

    public void setSerialNumber(Integer serialNumber) {
        this.serialNumber = serialNumber;
    }

    public Boolean getGroupIsOvert() {
        return groupIsOvert;
    }

    public void setGroupIsOvert(Boolean groupIsOvert) {
        this.groupIsOvert = groupIsOvert;
    }

    public Boolean getDeleted() {
        return deleted;
    }

    public void setDeleted(Boolean deleted) {
        this.deleted = deleted;
    }

    public LocalDateTime getInsertTime() {
        return insertTime;
    }

    public void setInsertTime(LocalDateTime insertTime) {
        this.insertTime = insertTime;
    }

    public LocalDateTime getUpdateTime() {
        return updateTime;
    }

    public void setUpdateTime(LocalDateTime updateTime) {
        this.updateTime = updateTime;
    }

    @Override
    public String toString() {
        return "UserCollectGroup{" +
                "id=" + id +
                ", userId=" + userId +
                ", groupName=" + groupName +
                ", serialNumber=" + serialNumber +
                ", groupIsOvert=" + groupIsOvert +
                ", deleted=" + deleted +
                ", insertTime=" + insertTime +
                ", updateTime=" + updateTime +
                "}";
    }
}
